<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>InFact: src/infact/factory.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">InFact
   
   </div>
   <div id="projectbrief">Interpreter and factory for easily creating C++ objects at run-time</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#namespaces">Namespaces</a> &#124;
<a href="#define-members">Defines</a>  </div>
  <div class="headertitle">
<div class="title">src/infact/factory.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Provides a generic dynamic object factory.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;iostream&gt;</code><br/>
<code>#include &lt;sstream&gt;</code><br/>
<code>#include &lt;memory&gt;</code><br/>
<code>#include &lt;unordered_map&gt;</code><br/>
<code>#include &lt;unordered_set&gt;</code><br/>
<code>#include &lt;vector&gt;</code><br/>
<code>#include &lt;stdexcept&gt;</code><br/>
<code>#include &quot;<a class="el" href="environment_8h_source.html">environment.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="error_8h_source.html">error.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="stream-tokenizer_8h_source.html">stream-tokenizer.h</a>&quot;</code><br/>
</div>
<p><a href="factory_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name.html">infact::TypeName&lt; T &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">We use the templated class <a class="el" href="classinfact_1_1_type_name.html" title="We use the templated class TypeName to be able to take an actual C++ type and get the type name strin...">TypeName</a> to be able to take an actual C++ type and get the type name string used by the <a class="el" href="classinfact_1_1_interpreter.html">Interpreter </a> and <a class="el" href="classinfact_1_1_environment.html">Environment </a> classes.  <a href="classinfact_1_1_type_name.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name_3_01bool_01_4.html">infact::TypeName&lt; bool &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A specialization so that an object of type <code>bool</code> converts to <code>"bool"</code>.  <a href="classinfact_1_1_type_name_3_01bool_01_4.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name_3_01int_01_4.html">infact::TypeName&lt; int &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A specialization so that an object of type <code>int</code> converts to <code>"int"</code>.  <a href="classinfact_1_1_type_name_3_01int_01_4.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name_3_01double_01_4.html">infact::TypeName&lt; double &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A specialization so that an object of type <code>double</code> converts to <code>"double"</code>.  <a href="classinfact_1_1_type_name_3_01double_01_4.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name_3_01string_01_4.html">infact::TypeName&lt; string &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A specialization so that an object of type <code>string</code> converts to <code>"string"</code>.  <a href="classinfact_1_1_type_name_3_01string_01_4.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name_3_01shared__ptr_3_01_t_01_4_01_4.html">infact::TypeName&lt; shared_ptr&lt; T &gt; &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A partial specialization so that an object of type <code>shared_ptr&lt;T&gt;</code>, where <code>T</code> is some <a class="el" href="classinfact_1_1_factory.html">Factory</a>-constructible type, converts to the string produced by <code><a class="el" href="classinfact_1_1_type_name.html" title="We use the templated class TypeName to be able to take an actual C++ type and get the type name strin...">TypeName</a>&lt;T&gt;</code>.  <a href="classinfact_1_1_type_name_3_01shared__ptr_3_01_t_01_4_01_4.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_type_name_3_01vector_3_01_t_01_4_01_4.html">infact::TypeName&lt; vector&lt; T &gt; &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A partial specialization so that an object of type <code>vector&lt;T&gt;</code> gets converted to the type name of <code>T</code> followed by the string <code>"[]"</code>, equivalent to the result of executing the following expression:  <a href="classinfact_1_1_type_name_3_01vector_3_01_t_01_4_01_4.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_member_initializer.html">infact::MemberInitializer</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">An interface for data member initializers of members of a <a class="el" href="classinfact_1_1_factory.html">Factory</a>-constructible object.  <a href="classinfact_1_1_member_initializer.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_typed_member_initializer.html">infact::TypedMemberInitializer&lt; T &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A concrete, typed implementation of the <a class="el" href="classinfact_1_1_member_initializer.html" title="An interface for data member initializers of members of a Factory-constructible object.">MemberInitializer</a> base class.  <a href="classinfact_1_1_typed_member_initializer.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_initializers.html">infact::Initializers</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A container for all the member initializers for a particular Factory-constructible instance.  <a href="classinfact_1_1_initializers.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_factory_base.html">infact::FactoryBase</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">An interface for all <a class="el" href="classinfact_1_1_factory.html">Factory</a> instances, specifying a few pure virtual methods.  <a href="classinfact_1_1_factory_base.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_factory_container.html">infact::FactoryContainer</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A class to hold all <a class="el" href="classinfact_1_1_factory.html">Factory</a> instances that have been created.  <a href="classinfact_1_1_factory_container.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_constructor.html">infact::Constructor&lt; T &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">An interface with a single virtual method that constructs a concrete instance of the abstract type <code>T</code>.  <a href="classinfact_1_1_constructor.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_factory_constructible.html">infact::FactoryConstructible</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">An interface simply to make it easier to implement <a class="el" href="classinfact_1_1_factory.html">Factory</a>-constructible types by implementing both required methods to do nothing (use of this interface is completely optional; read more for more information).  <a href="classinfact_1_1_factory_constructible.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classinfact_1_1_factory.html">infact::Factory&lt; T &gt;</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classinfact_1_1_factory.html" title="Factory for dynamically created instance of the specified type.">Factory</a> for dynamically created instance of the specified type.  <a href="classinfact_1_1_factory.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceinfact.html">infact</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight"><p>The namespace for the entire InFact library. </p>
<br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#ac51fe909a3ebeed75d2995096306c7cb">INFACT_ADD_PARAM</a>(param)&#160;&#160;&#160;initializers.Add(#param, &amp;_ ## param)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A macro to make it easy to register a parameter for initialization inside a <code>RegisterInitializers</code> implementation, in a very readable way.  <a href="#ac51fe909a3ebeed75d2995096306c7cb"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#a6398dd334cb48923f39b26dbcf2497b9">INFACT_ADD_PARAM_</a>(param)&#160;&#160;&#160;initializers.Add(#param, &amp;param ## _)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A macro to make it easy to register a parameter for initialization inside a <code>RegisterInitializers</code> implementation, in a very readable way.  <a href="#a6398dd334cb48923f39b26dbcf2497b9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#a3d20c0cb4655d546c046123a8b70806f">INFACT_ADD_REQUIRED_PARAM</a>(param)&#160;&#160;&#160;initializers.Add(#param, &amp;_ ## param, true)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Identical to <a class="el" href="factory_8h.html#ac51fe909a3ebeed75d2995096306c7cb">INFACT_ADD_PARAM</a> but for a required parameter.  <a href="#a3d20c0cb4655d546c046123a8b70806f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#ad079b320f02a7a940b66c2e10162e321">INFACT_ADD_REQUIRED_PARAM_</a>(param)&#160;&#160;&#160;initializers.Add(#param, &amp;param ## _, true)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Identical to <a class="el" href="factory_8h.html#a6398dd334cb48923f39b26dbcf2497b9">INFACT_ADD_PARAM_</a> but for a required parameter.  <a href="#ad079b320f02a7a940b66c2e10162e321"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#ae1e1f80dddb9011fa00e128c3eccc7bd">INFACT_ADD_TEMPORARY</a>(type, var)&#160;&#160;&#160;initializers.Add(#var, static_cast&lt;type *&gt;(nullptr))</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A macro to make it easier to register a temporary variable inside a <code>RegisterInitializers</code> implementation, for extraction from the <a class="el" href="classinfact_1_1_environment.html">Environment </a> inside a <code>PostInit</code> implementation.  <a href="#ae1e1f80dddb9011fa00e128c3eccc7bd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#a26a18d2d4565d41ecc64cb5d96862132">INFACT_ADD_REQUIRED_TEMPORARY</a>(type, var)&#160;&#160;&#160;initializers.Add(#var, static_cast&lt;type *&gt;(nullptr), true)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Identical to <a class="el" href="factory_8h.html#ae1e1f80dddb9011fa00e128c3eccc7bd">INFACT_ADD_TEMPORARY</a> but for a required temporary.  <a href="#a26a18d2d4565d41ecc64cb5d96862132"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#a0440aa6c8d7080a9daa203766dae388d">DEFINE_CONS_CLASS</a>(TYPE, NAME, BASE)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">A macro to define a subclass of <a class="el" href="classinfact_1_1_constructor.html">Constructor </a> whose NewInstance method constructs an instance of <em>TYPE</em>, a concrete subclass of <em>BASE</em>.  <a href="#a0440aa6c8d7080a9daa203766dae388d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#a0b09e4aaef613d7556c07875c7d5a029">REGISTER_NAMED</a>(TYPE, NAME, BASE)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">This macro registers the concrete subtype <em>TYPE</em> with the specified factory for instances of type <em>BASE</em>; the <em>TYPE</em> is associated with the specified <em>NAME</em>.  <a href="#a0b09e4aaef613d7556c07875c7d5a029"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="factory_8h.html#a01b208854b036ee1381a9289186ff3c2">IMPLEMENT_FACTORY</a>(BASE)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Provides the necessary implementation for a factory for the specified <code>BASE</code> class type.  <a href="#a01b208854b036ee1381a9289186ff3c2"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Provides a generic dynamic object factory. </p>
<dl class="author"><dt><b>Author:</b></dt><dd><a href="mailto:dbikel@google.com">dbikel@google.com</a> (Dan Bikel) </dd></dl>

<p>Definition in file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>
</div><hr/><h2>Define Documentation</h2>
<a class="anchor" id="a0440aa6c8d7080a9daa203766dae388d"></a><!-- doxytag: member="factory.h::DEFINE_CONS_CLASS" ref="a0440aa6c8d7080a9daa203766dae388d" args="(TYPE, NAME, BASE)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#a0440aa6c8d7080a9daa203766dae388d">DEFINE_CONS_CLASS</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">TYPE, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">NAME, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">BASE&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keyword">class </span>NAME ## Constructor : <span class="keyword">public</span> infact::Constructor&lt;BASE&gt; { \
   public: <span class="keyword">virtual</span> BASE *NewInstance()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">new</span> TYPE(); } };
</pre></div>
<p>A macro to define a subclass of <a class="el" href="classinfact_1_1_constructor.html">Constructor </a> whose NewInstance method constructs an instance of <em>TYPE</em>, a concrete subclass of <em>BASE</em>. </p>
<p>The concrete subclass <em>TYPE</em> must have a no-argument constructor. <code>This</code> is a helper macro used only by the <code>REGISTER</code> macro. </p>

<p>Definition at line <a class="el" href="factory_8h_source.html#l01016">1016</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="a01b208854b036ee1381a9289186ff3c2"></a><!-- doxytag: member="factory.h::IMPLEMENT_FACTORY" ref="a01b208854b036ee1381a9289186ff3c2" args="(BASE)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#a01b208854b036ee1381a9289186ff3c2">IMPLEMENT_FACTORY</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">BASE</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><span class="keyword">template</span>&lt;&gt; <span class="keywordtype">int</span> <a class="code" href="classinfact_1_1_factory.html" title="Factory for dynamically created instance of the specified type.">infact::Factory&lt;BASE&gt;::initialized_</a> = 0; \
  template&lt;&gt; <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classinfact_1_1_factory.html" title="Factory for dynamically created instance of the specified type.">infact::Factory&lt;BASE&gt;::base_name_</a> = #BASE;
</pre></div>
<p>Provides the necessary implementation for a factory for the specified <code>BASE</code> class type. </p>

<p>Definition at line <a class="el" href="factory_8h_source.html#l01037">1037</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="ac51fe909a3ebeed75d2995096306c7cb"></a><!-- doxytag: member="factory.h::INFACT_ADD_PARAM" ref="ac51fe909a3ebeed75d2995096306c7cb" args="(param)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#ac51fe909a3ebeed75d2995096306c7cb">INFACT_ADD_PARAM</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">param</td><td>)</td>
          <td>&#160;&#160;&#160;initializers.Add(#param, &amp;_ ## param)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A macro to make it easy to register a parameter for initialization inside a <code>RegisterInitializers</code> implementation, in a very readable way. </p>
<p>This macro assumes that you want to register a parameter with the name <b><code>"param"</code></b> for a data member with the <em>underscore-initial</em> name <b><code>_param</code></b>. It also asumes that the sole parameter in your <a class="el" href="classinfact_1_1_factory_constructible.html#a1c186ded6db298b7a84e5767e87c740f">FactoryConstructible::RegisterInitializers </a> implementation is called <code>initializers</code>.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classinfact_1_1_factory_constructible.html#a1c186ded6db298b7a84e5767e87c740f" title="Registers data members of this class for initialization when an instance is constructed via the Facto...">infact::FactoryConstructible::RegisterInitializers</a> </dd></dl>

<p>Definition at line <a class="el" href="factory_8h_source.html#l00062">62</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="a6398dd334cb48923f39b26dbcf2497b9"></a><!-- doxytag: member="factory.h::INFACT_ADD_PARAM_" ref="a6398dd334cb48923f39b26dbcf2497b9" args="(param)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#a6398dd334cb48923f39b26dbcf2497b9">INFACT_ADD_PARAM_</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">param</td><td>)</td>
          <td>&#160;&#160;&#160;initializers.Add(#param, &amp;param ## _)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A macro to make it easy to register a parameter for initialization inside a <code>RegisterInitializers</code> implementation, in a very readable way. </p>
<p>This macro assumes that you want to register a parameter with the name <b><code>"param"</code></b> for a data member with the <em>underscore-final</em> name <b><code>param_</code></b>. It also asumes that the sole parameter in your <a class="el" href="classinfact_1_1_factory_constructible.html#a1c186ded6db298b7a84e5767e87c740f">FactoryConstructible::RegisterInitializers </a> implementation is called <code>initializers</code>.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classinfact_1_1_factory_constructible.html#a1c186ded6db298b7a84e5767e87c740f" title="Registers data members of this class for initialization when an instance is constructed via the Facto...">infact::FactoryConstructible::RegisterInitializers</a> </dd></dl>

<p>Definition at line <a class="el" href="factory_8h_source.html#l00075">75</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="a3d20c0cb4655d546c046123a8b70806f"></a><!-- doxytag: member="factory.h::INFACT_ADD_REQUIRED_PARAM" ref="a3d20c0cb4655d546c046123a8b70806f" args="(param)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#a3d20c0cb4655d546c046123a8b70806f">INFACT_ADD_REQUIRED_PARAM</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">param</td><td>)</td>
          <td>&#160;&#160;&#160;initializers.Add(#param, &amp;_ ## param, true)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Identical to <a class="el" href="factory_8h.html#ac51fe909a3ebeed75d2995096306c7cb">INFACT_ADD_PARAM</a> but for a required parameter. </p>

<p>Definition at line <a class="el" href="factory_8h_source.html#l00079">79</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="ad079b320f02a7a940b66c2e10162e321"></a><!-- doxytag: member="factory.h::INFACT_ADD_REQUIRED_PARAM_" ref="ad079b320f02a7a940b66c2e10162e321" args="(param)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#ad079b320f02a7a940b66c2e10162e321">INFACT_ADD_REQUIRED_PARAM_</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">param</td><td>)</td>
          <td>&#160;&#160;&#160;initializers.Add(#param, &amp;param ## _, true)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Identical to <a class="el" href="factory_8h.html#a6398dd334cb48923f39b26dbcf2497b9">INFACT_ADD_PARAM_</a> but for a required parameter. </p>

<p>Definition at line <a class="el" href="factory_8h_source.html#l00083">83</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="a26a18d2d4565d41ecc64cb5d96862132"></a><!-- doxytag: member="factory.h::INFACT_ADD_REQUIRED_TEMPORARY" ref="a26a18d2d4565d41ecc64cb5d96862132" args="(type, var)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#a26a18d2d4565d41ecc64cb5d96862132">INFACT_ADD_REQUIRED_TEMPORARY</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">type, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">var&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;initializers.Add(#var, static_cast&lt;type *&gt;(nullptr), true)</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Identical to <a class="el" href="factory_8h.html#ae1e1f80dddb9011fa00e128c3eccc7bd">INFACT_ADD_TEMPORARY</a> but for a required temporary. </p>
<p>While the phrase &ldquo;required temporary&rdquo; might sound like an oxymoron, it is not; rather, it simply refers to a named variable that <em>must</em> be specified when constructing a particular type of <a class="el" href="classinfact_1_1_factory.html">Factory</a>-constructible object, but still a variable that can only be accessed from the <a class="el" href="classinfact_1_1_environment.html">Environment </a> available in that class&rsquo; <code>PostInit</code> method. For example, the current definition of <a class="el" href="classinfact_1_1_sheep.html#a5fc9522fe9d8cb71ef61ddb732aff63f">Sheep::RegisterInitializers </a> has a variable named <code>"age"</code> that is a non-required temporary. As such, it need not be specified when constructing a <code>Sheep</code>: </p>
<div class="fragment"><pre class="fragment"> s = Sheep(name(<span class="stringliteral">&quot;Sleepy&quot;</span>));  <span class="comment">// A currently legal Sheep spec.</span>
</pre></div><p> If we changed the line in <a class="el" href="classinfact_1_1_sheep.html#a5fc9522fe9d8cb71ef61ddb732aff63f">Sheep::RegisterInitializers </a> from <code><a class="el" href="factory_8h.html#ae1e1f80dddb9011fa00e128c3eccc7bd" title="A macro to make it easier to register a temporary variable inside a RegisterInitializers implementati...">INFACT_ADD_TEMPORARY(int, age)</a></code> to be <code><a class="el" href="factory_8h.html#a26a18d2d4565d41ecc64cb5d96862132" title="Identical to INFACT_ADD_TEMPORARY but for a required temporary.">INFACT_ADD_REQUIRED_TEMPORARY(int, age)</a></code> then the above would cause an error: </p>
<div class="fragment"><pre class="fragment"> <span class="comment">// Sheep specs if age were a required temporary.</span>
 s = Sheep(name(<span class="stringliteral">&quot;Sleepy&quot;</span>));          <span class="comment">// illegal: age not specified</span>
 s = Sheep(name(<span class="stringliteral">&quot;Sleepy&quot;</span>), age(3));  <span class="comment">// legal</span>
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classinfact_1_1_factory_constructible.html#abbcefaf8b2137f888ef133807cefe083" title="Does any additional initialization after an instance of this class has been constructed, crucially giving access to the Environment  that was in use and modified during construction by the Factory::CreateOrDie  method.">infact::FactoryConstructible::PostInit</a> </dd></dl>

<p>Definition at line <a class="el" href="factory_8h_source.html#l00124">124</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="ae1e1f80dddb9011fa00e128c3eccc7bd"></a><!-- doxytag: member="factory.h::INFACT_ADD_TEMPORARY" ref="ae1e1f80dddb9011fa00e128c3eccc7bd" args="(type, var)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#ae1e1f80dddb9011fa00e128c3eccc7bd">INFACT_ADD_TEMPORARY</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">type, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">var&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;initializers.Add(#var, static_cast&lt;type *&gt;(nullptr))</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>A macro to make it easier to register a temporary variable inside a <code>RegisterInitializers</code> implementation, for extraction from the <a class="el" href="classinfact_1_1_environment.html">Environment </a> inside a <code>PostInit</code> implementation. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classinfact_1_1_factory_constructible.html#a1c186ded6db298b7a84e5767e87c740f" title="Registers data members of this class for initialization when an instance is constructed via the Facto...">infact::FactoryConstructible::RegisterInitializers</a> </dd>
<dd>
<a class="el" href="classinfact_1_1_factory_constructible.html#abbcefaf8b2137f888ef133807cefe083" title="Does any additional initialization after an instance of this class has been constructed, crucially giving access to the Environment  that was in use and modified during construction by the Factory::CreateOrDie  method.">infact::FactoryConstructible::PostInit</a> </dd></dl>

<p>Definition at line <a class="el" href="factory_8h_source.html#l00093">93</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
<a class="anchor" id="a0b09e4aaef613d7556c07875c7d5a029"></a><!-- doxytag: member="factory.h::REGISTER_NAMED" ref="a0b09e4aaef613d7556c07875c7d5a029" args="(TYPE, NAME, BASE)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define <a class="el" href="factory_8h.html#a0b09e4aaef613d7556c07875c7d5a029">REGISTER_NAMED</a></td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">TYPE, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">NAME, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">BASE&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<b>Value:</b><div class="fragment"><pre class="fragment"><a class="code" href="factory_8h.html#a0440aa6c8d7080a9daa203766dae388d" title="A macro to define a subclass of Constructor  whose NewInstance method constructs an instance of TYPE...">DEFINE_CONS_CLASS</a>(TYPE,NAME,BASE) \
  static <span class="keyword">const</span> <a class="code" href="classinfact_1_1_constructor.html" title="An interface with a single virtual method that constructs a concrete instance of the abstract type T...">infact::Constructor&lt;BASE&gt;</a> *NAME ## _my_protoype = <a class="code" href="classinfact_1_1_factory.html#a39e6a67a0a3f5ba160195bd23826d8aa" title="The method used by the REGISTER_NAMED macro to ensure that subclasses add themselves to the factory...">\</a>
<a class="code" href="classinfact_1_1_factory.html#a39e6a67a0a3f5ba160195bd23826d8aa" title="The method used by the REGISTER_NAMED macro to ensure that subclasses add themselves to the factory...">      infact::Factory&lt;BASE&gt;::Register</a>(<span class="keywordtype">string</span>(#NAME), <span class="keyword">new</span> NAME ## Constructor());
</pre></div>
<p>This macro registers the concrete subtype <em>TYPE</em> with the specified factory for instances of type <em>BASE</em>; the <em>TYPE</em> is associated with the specified <em>NAME</em>. </p>
<p>This macro&mdash;or a macro defined using this macro&mdash;should be used in the implementation file for a concrete subclass <em>TYPE</em> of the baseclass <em>BASE</em>. Often, <em>TYPE</em> and <em>NAME</em> may be the exact same string; however, they must be different when <em>TYPE</em> contains characters that may not appear in C++ identifiers, such as colons (<em>e.g.</em>, when <em>TYPE</em> is the fully-qualified name of an inner class). </p>

<p>Definition at line <a class="el" href="factory_8h_source.html#l01030">1030</a> of file <a class="el" href="factory_8h_source.html">factory.h</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Wed Apr 23 2014 10:07:52 for InFact by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
